package com.husong.impl.base;

import com.husong.cons.ReturnCodeAndMsg;
import com.husong.mapper.*;
import com.husong.pojo.ReturnJsonBean;
import com.husong.util.JPush;

import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author MaxMin.
 */

public class BaseService {
    @Autowired
    protected UserMapper userMapper;

    @Autowired
    protected OrderMapper orderMapper;

    @Autowired
    protected CommentMapper commentMapper;

    @Autowired
    protected AdvertMapper advertMapper;
    
    @Autowired
    protected JPush jPush;
    
    @Autowired
    protected OrderLikeMapper orderLikeMapper;
    
    /**
     * 成功的json
     *
     * @param rb
     */
    protected void returnSuccess(ReturnJsonBean rb) {
        rb.setCode(ReturnCodeAndMsg.SUCCESS);
        rb.setMessage(ReturnCodeAndMsg.SUCCESS_MSG);
    }

    /**
     * 失败的json
     *
     * @param rb
     * @param code
     * @param msg
     */
    protected void returnFail(ReturnJsonBean rb, int code, String msg) {
        rb.setCode(code);
        rb.setMessage(msg);
    }
}
